// townscript voor town 3: Thralni's Castle

begintownscript;

variables;

int choice,i,j,x;

body;

beginstate INIT_STATE;

	set_name(9,"Bohevan");
	set_name(10,"Stella");
	set_name(21,"Captain Clunk");
	set_name(22,"Prison guard");
	set_name(23,"Prison guard");
	set_name(29,"Prisoner");
	set_name(32,"Torturer");
	set_name(33,"Torturer");
	
	set_level(8,30);
	set_name(8,"Emperor Thralni");
	set_level(10,15);
	set_level(11,15);
	set_level(12,15);
	set_level(13,15);
	set_level(14,15);
	set_level(15,15);
	set_level(16,15);
	set_level(17,15);
	set_level(18,15);
	set_level(21,17);
	set_level(20,10);
	set_level(19,10);
	set_level(57,15);
	
	if (get_flag(29,15) > 0) {
			erase_char(19);
			erase_char(20);
			erase_char(67);
			erase_char(40);
			erase_char(34);
			erase_char(9);
			}
	
	if (get_flag(20,20) == 1)
			erase_char(38);
	
	if (get_flag(29,18) == 1) {
			if (get_flag(3,10) == 0) {
					activate_hidden_group(11);
					}
			}
	
	if (get_flag(31,4) == 2) {
			activate_hidden_group(13);
			}

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
			
		if (get_flag(5,17) == 1) {
				set_state_continue(21);
				}

break;

beginstate 10;
if (get_flag(3,0) == 1)
		end();
	message_dialog("This a small storeroom. Crates and boxes are waiting to be unpacked.","");
	set_flag(3,0,1);
break;

beginstate 11;
if (get_flag(3,8) == 1)
		end();
	message_dialog("In this lab there were experiments with beam projectors and power sources. It seems logical, thinking of the fact how well made the power level of the Creation halls were.","");
	set_flag(3,8,1);
break;

beginstate 12;
if (get_flag(3,1) == 1)
		end();
	message_dialog("This is probably an old storeroom. Dust covers everything and spiderwebs finish it. It definitely wasn't used for ages.","Something interesting is standing in the middle of the room though: an old overused crystal. You wonder what purpose it once served.");
	set_flag(3,1,1);
break;

beginstate 13;
if (get_flag(3,2) == 1)
		end();
	message_dialog("This is probably an old storeroom. Dust covers everything and spiderwebs finish it. It definitely wasn't used for ages.","");
	set_flag(3,2,1);
break;

beginstate 14;
if (get_flag(3,3) == 1)
		end();
	reset_dialog();
	add_dialog_str(0,"When the doors before you open, you are immediately caught by astonishment. The room in front of you is enormous. Huge pillars stand on each side of the room, alongside huge statues, probably of old emperors and kings.",0);
	add_dialog_str(1,"In the center of the red carpet, on a heightening, you see the evil Emperor. The one man that caused so much suffering in his own Empire. However, the soldiers don't attack you. You wonder why, but then you see Thralni motioning you forward.",0);
	add_dialog_choice(0,"Okay");
	choice = run_dialog(1);
	set_flag(3,3,1);
break;

beginstate 15;
	move_to_new_town(4,22,28);
break;

beginstate 16;
	message_dialog("This corridor is darker than the rest of the prison area. Suddenly you hear a loud scream. When you hear whiplashes, you can imagine what the room in front of you is. You abruptly stop walking.","It is the place where you got tortured. for the love of god you really don't want to go to that place a second time.");
	block_entry(1);
break;

beginstate 17;
if (get_flag(3,5) == 1)
		end();
	message_dialog("In this small storeroom the whips and other torture devices are stored. Blood covers the ground.","");
	set_flag(3,5,1);
break;

beginstate 18;
if (get_flag(3,6) == 1)
		end();
	message_dialog("This looks like some sort of store room. Furniture and crates are stacked everywhere.","");
	set_flag(3,6,1);
break;

beginstate 19;
break;

beginstate 20;
if (get_flag(7,3) == 1) {
		message_dialog("You pick up the ring you find on this bookshelf. When you compare it to the note you found in the cave, you see its the same print!","Mayor Ruth should probably see this.");
		set_flag(7,3,2);
		}
break;

beginstate 21;

	set_flag(5,17,2);
	set_flag(5,19,1);
	set_flag(29,1,1);

	message_dialog("You apparently teleported to some sort of a castle. The guards seem very surprised to see you here, appearing just like that.","");
	
	relocate_character(0,23,22);
	relocate_character(1,24,22);
	relocate_character(2,25,22);
	relocate_character(3,26,22);
	force_instant_terrain_redraw();
	
	force_view_center(26,22);
	put_boom_on_char(0,2,0);
	put_boom_on_char(1,2,0);
	put_boom_on_char(2,2,0);
	put_boom_on_char(3,2,0);
	run_animation_sound(10);
	run_animation();
	pause(10);
	
	text_bubble_on_char(20,"?");
	text_bubble_on_char(19,"?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(20,"");
	text_bubble_on_char(19,"");
	text_bubble_on_char(20,"What the hell!?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(20,"");
	text_bubble_on_char(19,"Who are you!");
	force_instant_terrain_redraw();
	pause(20);

// mage appears and talks

	text_bubble_on_char(19,"");
	put_boom_on_char(9,2,0);
	activate_hidden_group(8);
	run_animation_sound(10);
	run_animation();
	pause(20);
	
	text_bubble_on_char(20,"?");
	text_bubble_on_char(19,"?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(20,"");
	text_bubble_on_char(19,"");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"I sent them.");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"They are the cause");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"of all our problems.");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"They ruined the creation halls...");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(20,"*gasp*");
	text_bubble_on_char(19,"*gasp*");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(20,"");
	text_bubble_on_char(19,"");
	force_instant_terrain_redraw();
	pause(10);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"...and destroyed the Senarti fort");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"Now,");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"they shall be punished");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(10);
	
	text_bubble_on_char(9,"MHUHAHAHAHA!!");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(20,"MHUHAHAHAHA!!");
	text_bubble_on_char(19,"MHUHAHAHAHA!!");
	force_instant_terrain_redraw();
	pause(8);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(5);
	
	text_bubble_on_char(9,"MHUHAHAHAHA!!");
	text_bubble_on_char(20,"");
	text_bubble_on_char(19,"");
	force_instant_terrain_redraw();
	pause(5);
	
	text_bubble_on_char(19,"MHUHAHAHAHA!!");
	force_instant_terrain_redraw();
	pause(5);
	
	text_bubble_on_char(20,"MHUHAHAHAHA!!");
	force_instant_terrain_redraw();
	pause(8);
	
	text_bubble_on_char(9,"*cough*");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(9,"*cough*");
	text_bubble_on_char(20,"");
	text_bubble_on_char(19,"");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(9,"*cough*");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(9,"phew");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"Bad cough.");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(20,"Want a peppermint?");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(20,"");
	force_instant_terrain_redraw();
	pause(7);
	
	text_bubble_on_char(9,"No, thanks.");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(9,"");
	force_instant_terrain_redraw();
	pause(5);
	
	text_bubble_on_char(9,"Gentlemen,");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"follow me please.");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(1,"You mean us?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(1,"");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"Of course I mean you!");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(9,"");
	text_bubble_on_char(9,"Now follow me.");
	force_instant_terrain_redraw();
	pause(20);

// walking into throne room

	text_bubble_on_char(9,"");
	force_view_center(25,21);
	set_character_facing(20,6);
	set_character_facing(19,2);
	force_instant_terrain_redraw();
	pause(10);
	
	force_view_center(24,20);
	relocate_character(20,24,20);
	relocate_character(19,25,20);
	force_instant_terrain_redraw();
	pause(10);
	
	set_character_facing(20,0);
	set_character_facing(19,0);
	force_instant_terrain_redraw();
	pause(5);
	
	flip_terrain(25,20);
	flip_terrain(24,20);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(20,24,19);
	relocate_character(19,25,19);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,21,21);
	relocate_character(20,24,18);
	relocate_character(19,25,18);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,22,20);
	relocate_character(20,24,17);
	relocate_character(19,25,17);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,23,20);
	relocate_character(20,24,16);
	relocate_character(19,25,16);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,24,20);
	relocate_character(20,24,15);
	relocate_character(19,25,15);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,19);
	set_character_facing(9,0);
	relocate_character(20,24,14);
	relocate_character(19,25,14);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,18);
	march_party(24,21);
	relocate_character(9,24,19);
	relocate_character(20,24,13);
	relocate_character(19,25,13);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,17);
	march_party(24,20);
	relocate_character(9,24,18);
	relocate_character(20,24,12);
	relocate_character(19,25,12);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,16);
	march_party(24,19);
	relocate_character(9,24,17);
	relocate_character(20,24,11);
	relocate_character(19,25,11);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,15);
	march_party(24,18);
	relocate_character(9,24,16);
	relocate_character(20,24,10);
	relocate_character(19,25,10);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,14);
	march_party(24,17);
	relocate_character(9,24,15);
	relocate_character(20,24,9);
	relocate_character(19,25,9);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,13);
	march_party(24,16);
	relocate_character(9,24,14);
	relocate_character(20,24,8);
	relocate_character(19,25,8);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,12);
	march_party(24,15);
	relocate_character(9,24,13);
	set_character_facing(20,2);
	set_character_facing(19,6);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,11);
	march_party(24,14);
	relocate_character(9,24,12);
	relocate_character(20,23,8);
	relocate_character(19,26,8);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,10);
	march_party(24,13);
	relocate_character(9,24,11);
	relocate_character(20,22,8);
	relocate_character(19,27,8);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,9);
	march_party(24,12);
	relocate_character(9,24,10);
	set_character_facing(20,0);
	set_character_facing(19,0);
	force_instant_terrain_redraw();
	pause(5);
	
	force_view_center(24,8);
	march_party(24,11);
	relocate_character(9,24,9);
	relocate_character(20,22,7);
	relocate_character(19,27,7);
	force_instant_terrain_redraw();
	pause(5);
	
	march_party(24,10);
	relocate_character(9,24,8);
	relocate_character(20,22,6);
	relocate_character(19,27,6);
	force_instant_terrain_redraw();
	pause(5);
	
	march_party(24,9);
	set_character_facing(9,6);
	relocate_character(20,22,5);
	relocate_character(19,27,5);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,25,8);
	set_character_facing(20,4);
	set_character_facing(19,4);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,26,8);
	force_instant_terrain_redraw();
	pause(5);
	
	set_character_facing(9,0);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(9,26,7);
	force_instant_terrain_redraw();
	pause(5);
	
	set_character_facing(9,4);
	force_instant_terrain_redraw();
	pause(15);
	
// Speaking to Thralni

	text_bubble_on_char(8,"Hmmm");
	force_instant_terrain_redraw();
	pause(30);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"I thought you guys...");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"would be bigger...");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"Oh well.");
	force_instant_terrain_redraw();
	pause(25);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"So...");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"You destroyed my lifes work?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"That was bad of you to do.");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"Why?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"Why would you do that!?");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"To an old man!");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"Explain that to me.");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(1,"Well...");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(1,"");
	text_bubble_on_char(2,"You see...");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(2,"");
	text_bubble_on_char(8,"Yes?");
	force_instant_terrain_redraw();
	pause(20);

	reset_dialog();
	add_dialog_str(0,"Yeah, why did you do it?",0);
	add_dialog_choice(0,"I don't know...");
	add_dialog_choice(1,"People were suffering!");
	add_dialog_choice(2,"I'm an adventurer");
	choice = run_dialog(1);
	
	if (choice == 1) {
			text_bubble_on_char(8,"");
			text_bubble_on_char(3,"We don't know, actually");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(3,"");
			force_instant_terrain_redraw();
			pause(30);
	
			message_dialog("Thralni stares blankly at you. Slowly, a mad expression appears on his face. You can tell he is getting more worked up by the second.","");
			
			pause(10);
	
			text_bubble_on_char(8,"What?");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"My god");
			force_instant_terrain_redraw();
			pause(20);
			
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"I thought you were stupid, alright");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"But this is worse than I thought!");
			force_instant_terrain_redraw();
			pause(20);
			}
	
	if (choice == 2) {
			text_bubble_on_char(8,"");
			text_bubble_on_char(3,"People were suffering!");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(3,"");
			force_instant_terrain_redraw();
			pause(30);
	
			text_bubble_on_char(8,"Yeah, you got that right");
			force_instant_terrain_redraw();
			pause(20);
			}
	
	if (choice == 3) {
			text_bubble_on_char(8,"");
			text_bubble_on_char(3,"We are adventurers");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(3,"");
			text_bubble_on_char(3,"That's our job");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(3,"");
			text_bubble_on_char(8,"Ugh");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"Deliberate friendliness");
			force_instant_terrain_redraw();
			
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"I think I'm going to puke");
			force_instant_terrain_redraw();
			pause(20);
	
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"Unless");
			force_instant_terrain_redraw();
			pause(20);
			
			text_bubble_on_char(8,"");
			force_instant_terrain_redraw();
			pause(20);
			
			text_bubble_on_char(8,"");
			text_bubble_on_char(8,"Hmmm");
			force_instant_terrain_redraw();
			pause(20);
			
			text_bubble_on_char(8,"");
			force_instant_terrain_redraw();
			pause(20);
			}
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"GUARDS!!");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"TAKE THEM!!");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"TORTURE THEM!!");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"THEN THROW THEM IN...");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(8,"");
	text_bubble_on_char(8,"the PIT!!");
	force_instant_terrain_redraw();
	pause(20);
	
	text_bubble_on_char(16,"Oh no!");
	force_instant_terrain_redraw();
	pause(3);
	
	text_bubble_on_char(16,"");
	text_bubble_on_char(13,"Poor you");
	force_instant_terrain_redraw();
	pause(3);
	
	text_bubble_on_char(13,"");
	text_bubble_on_char(17,"*giggle*");
	force_instant_terrain_redraw();
	pause(3);
	
	text_bubble_on_char(17,"");
	text_bubble_on_char(18,"Oooooh!");
	force_instant_terrain_redraw();
	pause(3);

	text_bubble_on_char(18,"");
	text_bubble_on_char(13,"Poor you");
	force_instant_terrain_redraw();
	pause(3);
	
	text_bubble_on_char(13,"");
	text_bubble_on_char(17,"*giggle*");
	force_instant_terrain_redraw();
	pause(3);
	
	text_bubble_on_char(17,"");
	text_bubble_on_char(18,"Oooooh!");
	force_instant_terrain_redraw();
	pause(3);
	
	text_bubble_on_char(18,"");
	force_instant_terrain_redraw();
	pause(10);
	
	message_dialog("Two guards, the ones that first stood at the doors when you arrived, take you away. You go through a narrow, dark corridor, until you hear screaming. Its the torturing chamber.","When the door opens, you can't believe your eyes. So much blood! A young man is standing, whining. Apparently, its one at a time. One of your adventurers can go in, while the rest waits outside. This could get painful.");
	
	relocate_character(0,43,42);
	relocate_character(1,43,41);
	relocate_character(2,43,40);
	relocate_character(3,43,39);
	set_character_facing(0,4);
	set_character_facing(1,4);
	set_character_facing(2,4);
	set_character_facing(3,4);
	force_view_center(43,43);
	force_instant_terrain_redraw();
	pause(5);
	
	text_bubble_on_char(68,"You!");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(68,"");
	text_bubble_on_char(68,"Front in row");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(68,"");
	text_bubble_on_char(68,"Come with me.");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(68,"");
	force_instant_terrain_redraw();
	pause(15);
	
	set_character_facing(68,2);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(68,43,44);
	relocate_character(0,43,43);
	force_instant_terrain_redraw();
	pause(5);
	
	flip_terrain(43,44);
	force_instant_terrain_redraw();
	run_animation_sound(58);
	pause(10);
	
	relocate_character(0,43,44);
	relocate_character(68,42,44);
	force_instant_terrain_redraw();
	pause(5);
	
	set_character_facing(0,2);
	relocate_character(68,41,44);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(0,42,44);
	relocate_character(68,40,44);
	force_instant_terrain_redraw();
	pause(5);
	
	relocate_character(0,41,44);
	relocate_character(68,39,44);
	force_instant_terrain_redraw();
	pause(5);
	
	set_character_facing(68,6);
	force_instant_terrain_redraw();
	pause(5);
	
	flip_terrain(43,44);
	force_instant_terrain_redraw();
	run_animation_sound(58);
	pause(20);
	
	text_bubble_on_char(68,"he he he");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(68,"");
	text_bubble_on_char(68,"Welcome to the world");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(68,"");
	text_bubble_on_char(68,"of PAIN");
	force_instant_terrain_redraw();
	pause(15);
	
	text_bubble_on_char(68,"");
	text_bubble_on_char(68,"he he he he!");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(68,"");
	text_bubble_on_char(33,"he he he he!");
	text_bubble_on_char(29,"he he he he!");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(29,"");
	text_bubble_on_char(33,"hi hi hi hi!");
	text_bubble_on_char(68,"he he he he!");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(33,"");
	text_bubble_on_char(68,"");
	text_bubble_on_char(29,"he he he he!");
	text_bubble_on_char(68,"ha ha ha ha!");
	force_instant_terrain_redraw();
	pause(6);
	
	text_bubble_on_char(33,"");
	text_bubble_on_char(68,"");
	text_bubble_on_char(29,"");
	force_instant_terrain_redraw();
	pause(20);
	
	message_dialog("The torturers begin to beat you, kick you, spit on you, doing whatever a torturer must do. Because of general author laziness and child-friendliness, you won't see the beating part.","You wake up, almost dead, without energy or usable potions. He wants to really see you suffer for what you did, you can see that now. However, if this is the _pit_ he was talking about, it isn't that bad anyway, is it?");
	
	message_dialog("Author note to the player: because of certain flaws in BoA's engine, please take a step in whatever direction. This will activate the last special node and finish this cutscene.","Thank you");
	
	change_char_health(0,-150);
	change_char_health(1,-150);
	change_char_health(2,-150);
	change_char_health(3,-150);
	change_char_health(4,-150);
	change_char_health(5,-150);
	
	change_char_energy(0,-100);
	change_char_energy(1,-100);
	change_char_energy(2,-100);
	change_char_energy(3,-100);
	change_char_energy(4,-100);
	change_char_energy(5,-100);
	
	i = 0;
	j = 1;
	while (i < 499) {
 		if (j == 1)
    		i = 220;
  		if (j == 2)
    		i = 221;
  		if (j == 3)
    		i = 222; 
  		if (j == 4)
   			i = 223;
   		if (j == 5)
   			i = 225;
   		if (j == 6)
   			i = 226;
   		if (j == 7)
   			i = 227;
   		if (j == 8)
   			i = 228;
   		if (j == 9)
   			i = 229;
   		if (j == 10)
   			i = 230;
   		if (j == 11)
   			i = 231;
   		if (j == 12)
   			i = 233;
   		if (j == 13)
   			i = 234;
   		if (j == 14)
   			i = 235;
   		if (j == 15)
   			i = 236;
   		if (j == 16)
   			i = 237;
   		if (j == 17)
   			i = 238;
   		if (j == 18)
   			i = 239;
   		if (j == 19)
   			i = 240;
   		if (j == 20)
   			i = 241;
   		if (j == 21)
   			i = 214;
   		if (j == 22)
   			i = 215;
   		if (j == 23)
   			i = 216;
   		if (j == 24)
   			i = 217;
   		if (j == 25)
   			i = 218;
   		if (j == 26)
   			i = 219;
   		if (j == 27)
   			i = 500;
   		if (i == 500)
   				end();
   		
   		take_all_of_item(i);
   		j = j + 1;
		}
break;
	
beginstate 22;
	move_to_new_town(29,8,45);
break;

beginstate 23;
if (get_flag(31,4) == 2) {
		message_dialog("You enter Thralni's castle. The hall is filled with guards. Your presence has been noted already when you were climbing the hill to get here. Prepare yourselves for some fighting.","");
		set_flag(31,4,3);
		end();
		}

if (get_flag(275,0) > 0) {
		message_dialog("It will be suicide to go in that direction. Now that you killed Thralni, all troops are probably alarmed. If you go out via the front gate, you will probably be killed instantly.","");
		block_entry(1);
		}
break;

beginstate 24;
if (get_flag(3,11) == 0) {
		message_dialog("The moment you reach the other side of the narrow lava bridge, two things appear at both sides of the bridge.","Thralni was wise enough not to leave the treasure unguarded.");

		put_boom_on_space(11,16,4,0);
		put_boom_on_space(11,14,4,0);
		run_animation_sound(54);
		pause(3);

		activate_hidden_group(15);
		
		put_boom_on_space(11,16,2,0);
		put_boom_on_space(11,14,2,0);
		run_animation_sound(10);
		set_flag(3,11,1);
		pause(3);
		}
break;

// Talk with Thralni starts here

beginstate 25;
if (get_flag(3,4) == 0) {
		reset_dialog();
		add_dialog_str(0,"There he is. The man who caused all the trouble. The man who killed his own citizens. You must kill him, but not now, not yet.",0);
		add_dialog_choice(0,"There is nothing to talk about. Prepare to die.");
		add_dialog_choice(1,"Why did you do all this?");
		add_dialog_choice(2,"Could you tell us about your family?");
		choice = run_dialog(1);
		
		if (choice == 1) {
				message_dialog("He looks at you, pulls his left eyebrow up, and then, in a commanding voice, he says: _Fine with me! You want to be killed right away. Well, let's start then, shall we?_","");

				set_flag(3,4,1);

				set_attitude(6,10);
				set_attitude(7,10);
				set_attitude(8,10);
				set_attitude(10,10);
				set_attitude(11,10);
				set_attitude(12,10);
				set_attitude(13,10);
				set_attitude(14,10);
				set_attitude(15,10);
				set_attitude(16,10);
				set_attitude(17,10);
				set_attitude(18,10);
				set_attitude(21,10);
				set_attitude(69,10);
		
				set_mobility(6,1);
				set_mobility(7,1);
				set_mobility(8,1);
				set_mobility(10,1);
				set_mobility(11,1);
				set_mobility(12,1);
				set_mobility(13,1);
				set_mobility(14,1);
				set_mobility(15,1);
				set_mobility(16,1);
				set_mobility(17,1);
				set_mobility(18,1);
				set_mobility(21,1);
				set_mobility(69,1);
				
				end();
				}
		
		if (choice == 2) {
				set_state_continue(26);
				}
		
		if (choice == 3) {
				set_state_continue(30);
				}
		
		}
break;

beginstate 26;
	reset_dialog();
	add_dialog_str(0,"He doesn't seem surprised that you ask this. _Think of it like this: You are a happy ruler and everybody likes you, then the Empire came and just started fighting me and my army. I didn't stand a chance. Wouldn't you seek revenge?_",0);
	add_dialog_choice(0,"Yes of course, but in this way? You are killing your own people!");
	add_dialog_choice(1,"No. I would have tried to come back to the province and to do it in a peaceful way.");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(27);
				}
		
		if (choice == 2) {
				set_state_continue(28);
				}
break;

beginstate 27;
	reset_dialog();
	add_dialog_str(0,"_Yes, that is an unfortunate thing in this case._ He stands up and sits again, in another pose. _You're absolutely right about that._",0);
	add_dialog_choice(0,"But, if you think it yourself too, why did you do it!? It's not right to do it in this way!");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(29);
				}
break;

beginstate 28;
	reset_dialog();
	add_dialog_str(0,"_Peaceful!_ He looks at you as if you were a pile of filth. _Peaceful. I don't think that was an option in this case. For God's sake! I had to flee my own territory!_",0);
	add_dialog_choice(0,"We understand that, but still. It is not right to do it in this way.");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(29);
				}
break;

beginstate 29;
	reset_dialog();
	add_dialog_str(0,"Mockingly, he repeats after you: _Not right in this way._ Then he looks at you like somebody looking at a pile of dirt. _I don't care about what you think of me. You'll die anyway. Any last questions before you die?_",0);
	add_dialog_choice(0,"Could you tell us about your family?");
	choice = run_dialog(1);

		if (choice == 1) {
				set_state_continue(30);
				}
break;

beginstate 30;
	reset_dialog();
	add_dialog_str(0,"He looks surprised at you. _What about them?_",0);
	add_dialog_choice(0,"An ancestor of you was a high commander in the Empire army, no?");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(31);
				}
break;

beginstate 31;
	reset_dialog();
	add_dialog_str(0,"_Ah, yes. Yes, that was indeed Thralni III._ The way he says the name, you suspect he wasn't the jewel of the family. _The bastard. He left the Thraldom and joined our enemies side! Can you imagine?_",0);
	add_dialog_choice(0,"So the Thraldom and the Empire were enemies for long before already?");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(32);
				}
break;

beginstate 32;
	reset_dialog();
	add_dialog_str(0,"He nods. _Yes. Ever since the Empire was small, it was arguing with the Thraldom. Mainly about land and such. It was only now, though, during my time, that they actually tried to conquer the Thraldom._",0);
	add_dialog_choice(0,"Would you have any idea why they would have waited so long?");
	add_dialog_choice(1,"The Empire is a strange place, but a powerful force.");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(33);
				}
		
		if (choice == 2) {
				set_state_continue(34);
				}
break;

beginstate 33;
	reset_dialog();
	add_dialog_str(0,"He shrugs. _There were spies. They tried to infiltrate us several times. They didn't succeed, though._ He nods while saying that. _And you, you little pesky rodents, are agents of the Empire, and that is why I want you dead._",0);
	add_dialog_choice(0,"The Empire is a strange place, but a powerful force.");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(34);
				}
break;

beginstate 34;
	reset_dialog();
	add_dialog_str(0,"He smirks. _Heh. You think so? They are cowards. You have no idea whatsoever of what they did to the Thraldom when they first came here, do you? Well, let me tell you._",0);
	add_dialog_choice(0,"No, we'd rather not hear it from you.");
	add_dialog_choice(1,"Please do so.");
	choice = run_dialog(1);
	
		if (choice == 1) {
				message_dialog("He seems surprised. Disgusted he looks at you. _Ugh. Empire agents, I hate them. I want to finish this off quickly._ He calls for his guards, and the fighting begins. This is the moment to kill Thralni. Don't fail Riverrod.","");

				set_flag(3,4,1);

				set_attitude(6,10);
				set_attitude(7,10);
				set_attitude(8,10);
				set_attitude(10,10);
				set_attitude(11,10);
				set_attitude(12,10);
				set_attitude(13,10);
				set_attitude(14,10);
				set_attitude(15,10);
				set_attitude(16,10);
				set_attitude(17,10);
				set_attitude(18,10);
				set_attitude(21,10);
				set_attitude(69,10);
		
				set_mobility(6,1);
				set_mobility(7,1);
				set_mobility(8,1);
				set_mobility(10,1);
				set_mobility(11,1);
				set_mobility(12,1);
				set_mobility(13,1);
				set_mobility(14,1);
				set_mobility(15,1);
				set_mobility(16,1);
				set_mobility(17,1);
				set_mobility(18,1);
				set_mobility(21,1);
				set_mobility(69,1);
				
				end();
				}
		
		if (choice == 2) {
				set_state_continue(35);
				}
break;

beginstate 35;
	reset_dialog();
	add_dialog_str(0,"He nods approvingly. _Good. Now listen carefully to all that I say. See if you still want to kill me after this._",0);
	add_dialog_str(1,"_The Thraldom and the Empire have been for a long time enemies of each other. However, the Thraldom never attacked the Empire, despite it being much larger and stronger at that time than the Empire. The Empire was still small._",0);
	add_dialog_str(2,"_My great grandfather Thralni I was, of course, the first to rule the Thraldom, but he wasn't the first Emperor. Thralni I was the one to claim the land for his people and to found the Thraldom. These were relatively quiet years._",0);
	add_dialog_str(3,"_However, as the Empire grew, it became more vicious. Around this time Avernum was discovered, and Thralni III, the fool, went into the Empire army. I don't believe this to have been his own choice. I think he was ordered to do it._",0);
	add_dialog_choice(0,"Why do you think that?");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(36);
				}
break;

beginstate 36;
	reset_dialog();
	add_dialog_str(0,"_For if he wouldn't have done it, the Empire would have surely attacked the Thraldom! If that is true, he wasn't such a bastard after all, but still. An Emperor doesn't leave his people. A good Emperor stays and protects his people.",0);
	add_dialog_choice(0,"And you, who kills his people, have the courage to say that!?");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(37);
				}
break;

beginstate 37;
	reset_dialog();
	add_dialog_str(0,"_I have been forced to do this. The Empire took the Thraldom and enslaved my people. I try to hit only Empire soldiers, but sometimes sacrifices have to be made. Now let me continue the story._ You remain silent and await his story.",0);
	add_dialog_str(1,"_For many years things remained quiet and nothing happened, until a few years back. Emperor Hawthorn was the ruler of the Empire. He was a vicious leader, and everybody was afraid of him. But then, when all seemed lost for us, he got killed._",0);
	add_dialog_str(2,"_By that time I was the Emperor of the Thraldom. I, of course, thought this to be excellent news. I was wrong. The Empire knew that the culprits were the Avernites, may the chicken gods bless them..._",0);
	add_dialog_choice(0,"We are Avernites!");
	choice = run_dialog(1);
	
		if (choice == 1) {
				set_state_continue(38);
				}
break;

beginstate 38;
	reset_dialog();
	add_dialog_str(0,"He looks surprised at you. _You are?_ He checks your skins, and sees that they are indeed rather pale. _How nice... However, let me continue with my story._ You let him speak.",0);
	add_dialog_str(1,"*Cough* _Anyhow, the Empire knew the Avernites sent assassins to kill Hawthorn, and they attacked Avernum. However, that wasn't enough for them. Now they had a reason to deal with everything they thought to be suspicious. They attacked us._",0);
	add_dialog_str(2,"_The war between the Empire and the Thraldom took a year, then the Thralnian forces were eradicated. The Empire unleashed its full force on the Thraldom. Many cities were burnt to the ground. Filberton was the one to suffer most._",0);
	add_dialog_str(3,"_Already in that time Filberton had a magery school of stunning quality. The Empire found it to be dangerous, and so they attacked Filberton first. After destroying most of Voughton and Pleasantville too, they stopped attacking._",0);
	add_dialog_str(4,"_Instead, they built the Riverrod Empire headquarters and Fort Filbert, to make sure nothing disturbing happens. Then they left us. We were to build our cities up again, without any help. I myself had to flee._",0);
	add_dialog_str(5,"Thralni stops speaking and looks at you. _And now what? Still want to kill me, or do you prove me right?_",0);
	add_dialog_choice(0,"That was a nice story, but you still can not kill your own people.");
	choice = run_dialog(1);
	
		if (choice == 1) {
				message_dialog("He nods. _Okay. if that is what you believe, fine._ He stands up and calls for his guards. _We shall deal with you at once._ This may be your only chance to kill Thralni and eradicate Riverrod's problem. Good luck. Don't fail Riverrod.","");

				set_flag(3,4,1);

				set_attitude(6,10);
				set_attitude(7,10);
				set_attitude(8,10);
				set_attitude(10,10);
				set_attitude(11,10);
				set_attitude(12,10);
				set_attitude(13,10);
				set_attitude(14,10);
				set_attitude(15,10);
				set_attitude(16,10);
				set_attitude(17,10);
				set_attitude(18,10);
				set_attitude(21,10);
				set_attitude(69,10);
		
				set_mobility(6,1);
				set_mobility(7,1);
				set_mobility(8,1);
				set_mobility(10,1);
				set_mobility(11,1);
				set_mobility(12,1);
				set_mobility(13,1);
				set_mobility(14,1);
				set_mobility(15,1);
				set_mobility(16,1);
				set_mobility(17,1);
				set_mobility(18,1);
				set_mobility(21,1);
				set_mobility(69,1);
				
				end();
				}
break;